package subject_set.lc200;

/**
 * @author haomin
 * @date 2023/04/24 20:24
 **/
public class Num82 {
    class Solution {
        public ListNode deleteDuplicates(ListNode head) {
            if(head == null) return head;
            ListNode dummyHead = new ListNode(-1);
            dummyHead.next = head;
            ListNode cur = dummyHead;
            while(cur.next != null && cur.next.next != null) {
                if(cur.next.val == cur.next.next.val) {
                    int x = cur.next.val;
                    while(cur.next != null && cur.next.val == x) {
                        cur.next = cur.next.next;
                    }
                }else {
                    cur = cur.next;
                }
            }
            return dummyHead.next;
        }
    }
}